package org.example.web;

import cn.hutool.json.JSONObject;
import org.example.dto.TestDto;
import org.example.mapper.TestMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("/test")
@RestController
public class TestController {
    @Autowired
    TestMapper testMapper;
    @RequestMapping("list")
    public JSONObject test(){
        List<TestDto> list = testMapper.list();
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("list",list);
        jsonObject.put("code",0);
        return jsonObject;
    }

}
